Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 10: Controlling Appearance with Materials

../ch10/10fig11.gif
Figure 10.11

A simple space station with animating transparency for the central sphere.

10fig11.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Station Shapes
        Shape {
            appearance Appearance {
                material DEF BallColor Material {
                    diffuseColor 1.0 0.0 0.0
                }
            }
            geometry Sphere { }
        },
        Shape {
            appearance Appearance {
                material Material {
                    diffuseColor 0.5 0.25 1.0
                }
            }
            geometry Cylinder {
                radius 2.0
                height 0.05
            }
        },
        Shape {
            appearance Appearance {
                material Material {
                    diffuseColor 0.75 0.0 1.0
                }
            }
            geometry Cylinder {
                radius 0.15
                height 5.0
            }
        },
    # Animation clock
        DEF Clock TimeSensor {
            cycleInterval 4.0
            loop TRUE
        },
    # Animation path
        DEF TransparencyPath ScalarInterpolator {
            key [ 0.0, 0.5, 1.0 ]
            keyValue [ 0.0, 1.0, 0.0 ]
        }
    ]
}
ROUTE Clock.fraction_changed         TO TransparencyPath.set_fraction
ROUTE TransparencyPath.value_changed TO BallColor.set_transparency